package test;

import java.util.Arrays;
import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        double[] fenshu = dafen();
        double a =  pinjun(fenshu);
        System.out.println(a);
    }

    public static double[] dafen(){
        int n;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入评委人数");
        n = sc.nextInt();
        double[] fenshu = new double[n];

        for(int i = 0;i<n;i++){
            System.out.println("请输入第"+(i+1)+"名评委的评分：");
            fenshu[i] = sc.nextDouble();
        }
        return fenshu;
    }
    public static double pinjun(double[] fenshu){
        Arrays.sort(fenshu);
        double min = fenshu[0];
        double max = fenshu[fenshu.length-1];
        double sum = 0;
        for(int i = 0;i<fenshu.length;i++){
            sum+=fenshu[i];
        }
        sum=sum-max-min;
        return sum/(fenshu.length-2);
    }
}
